<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%
request.setCharacterEncoding("UTF-8");
String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${_cxt}" >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加主商品</title>
		<link rel="stylesheet" type="text/css" href="css/htaddcomcs.css"/>
		<script type="text/javascript" src="js/jquery-2.2.3.min.js"></script>
		<script type="text/javascript" src="js/addcommod.js?<%=Math.random()%>"></script>
		<link rel="stylesheet" href="kindeditor/themes/default/default.css" />
		<link rel="stylesheet" href="kindeditor/plugins/code/prettify.css" />
		<script charset="utf-8" src="kindeditor/kindeditor.js"></script>
		<script charset="utf-8" src="kindeditor/lang/zh_CN.js"></script>
		<script charset="utf-8" src="kindeditor/plugins/code/prettify.js"></script>
		<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : 'kindeditor/plugins/code/prettify.css',
				uploadJson : 'kindeditor/jsp/upload_json.jsp',
				fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
	</head>
	<body>
		<div class="chongfuselect">
			<p>重复选择</p>
		</div>
		<div class="slelecttype">
			<div class="type">
				<div class="guanbi">
					<div class="gbtitle">
						<h3>选择分类
							<small>My Type</small>
						</h3>
					</div>
					<div class="gbimg">
						<img src="imgs/htimgs/dzgb.png" />
					</div>
				</div>
				<div class="type-box">
					<ul class="select">
						<li class="dengji">一级分类</li>
						<c:forEach var="c" items="${sortlist}">
							<li typeid="${c.lid}" parentid="${c.tparentid}" >${c.lname}</li>
						</c:forEach>
					</ul>
				</div>
			</div>
		</div>
		<div id="addcombox">
			<ul class="nav-tabs">
				<li class="active">
					<a>主商品信息</a>
				</li>
				<li>
					<a>描述</a>
				</li>
			</ul>
			<div class="tab-content">
				<form name="example" action="addcomm?v=addsp" method="post" enctype="multipart/form-data">
					<div class="content-form">
						<div class="content-form-item">
							<label class="content-form-label">
								商品名称
							</label>
							<div class="content-input-block">
								<input type="text" class="content-input" placeholder="请输入商品名称" name="cname" />
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								商品类别
							</label>
							<div class="content-input-block">
								<button type="button" class="layui-btn" id="settype">设置分类</button>
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								是否上架
							</label>
							<div class="content-input-block">
								<div class="content-form-radio content-form-radio-img">
								<input type="radio" checked="checked" name=sex value="0" style="display: none" >
									<i></i>
									<div>上架</div>
								</div>
								<div class="content-form-radio content-form-radio-notimg">
								<input type="radio" name=sex value="1" style="display: none" >
									<i></i>
									<div>下架</div>
								</div>
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								商品品牌
							</label>
							<div class="content-input-block">
								<select class="selectpingpai" name="pingpai">
									<option value ="">请选择</option>
									<c:forEach var="c" items="${brandslist}">
										<option bid="${c.bid}">${c.bname}</option>
									</c:forEach>
								</select>
								<input type="hidden" name="pp" id="pp" />
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								选择规格
							</label>
							<div class="content-input-block">
								<select class="selectguige">
									<option value ="">请选择</option>
									<c:forEach var="c" items="${attlist}">
										<option attid="${c.attid}">${c.attname}</option>
									</c:forEach>
								</select>
				
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								商品主图
							</label>
							<div class="inbox-body">
								<div class="main-imgs">
									<img src="imgs/htimgs/addspimg.png" />
									<input type="file" name="upimg" accept="image/png,image/gif,image/jpg,image/jpeg" />
								</div>	
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								商品推荐
							</label>
							<div class="content-input-block">
								<div class="content-unselect content-form-checkbox">
									<input type="text" name="zx" value="0" style="display: none" />
									<span>最新商品</span>
									<i class="content-icon layui-icon-ok">
						
									</i>
								</div>
								
								<div class="content-unselect content-form-checkbox">
									<input type="text" name="tej" value="0" style="display: none" />
									<span>特价商品</span>
									<i class="content-icon layui-icon-ok">
										
									</i>
								</div>
								<div class="content-unselect content-form-checkbox">
								<input type="text" name="rm" value="0" style="display: none" />
									<span>热卖商品</span>
									<i class="content-icon layui-icon-ok">
										
									</i>
								</div>
								<div class="content-unselect content-form-checkbox">
								<input type="text" name="tj" value="0" style="display: none" />
									<span>推荐商品</span>
									<i class="content-icon layui-icon-ok">
										
									</i>
								</div>
							</div>
						</div>
						<div class="content-form-item">
							<label class="content-form-label">
								
							</label>
							<div class="content-input-block">
								<input type="submit" value="保存" id="baocun" >
							</div>
						</div>
					</div>
				
					<div class="miaoshu">
						<div style="width: 800px;height: 400px;margin:20px auto;">
						<%=htmlData%>
							<textarea name="content1" cols="100" rows="8" style="width:800px;height:400px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
							<br />
						</div>
					</div>
				</form>
			</div>
		</div>
	</body>
	<%!
	private String htmlspecialchars(String str) {
		str = str.replaceAll("&", "&amp;");
		str = str.replaceAll("<", "&lt;");
		str = str.replaceAll(">", "&gt;");
		str = str.replaceAll("\"", "&quot;");
		return str;
	}
	%>
</html>